package com.ywjt.platformbusiness.widget;

import android.view.View;
import android.widget.TextView;

import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.base.BaseBottomDialog;


public class ApplyPickBottomDialog extends BaseBottomDialog {

    private TextView tvTakePhoto;
    private TextView tvSelectFromAlbum;
    private TextView tvCancel;

    private ClickListenerInterface clickListenerInterface;

    public interface ClickListenerInterface {
        void takePhoto();

        void applyAgent();
    }

    public ApplyPickBottomDialog() {
    }

    @Override
    public int getLayoutRes() {
        return R.layout.dialog_apply_pick;
    }

    @Override
    public void bindView(View v) {
        tvTakePhoto = v.findViewById(R.id.tvTakePhoto);
        tvSelectFromAlbum = v.findViewById(R.id.tvSelectFromAlbum);
        tvCancel = v.findViewById(R.id.tvCancel);
        tvTakePhoto.setOnClickListener(new clickListener());
        tvSelectFromAlbum.setOnClickListener(new clickListener());
        tvCancel.setOnClickListener(new clickListener());
    }

    public void setClicklistener(ClickListenerInterface clickListener) {
        clickListenerInterface = clickListener;
    }

    private class clickListener implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.tvTakePhoto:
                    dismiss();
                    clickListenerInterface.takePhoto();
                    break;
                case R.id.tvSelectFromAlbum:
                    dismiss();
                    clickListenerInterface.applyAgent();
                    break;
                case R.id.tvCancel:
                    dismiss();
                    break;
                default:
                    break;
            }
        }
    }
}
